package jade.oo.core.behaviours.state;

import jade.core.behaviours.Behaviour;

public class BehaviourWaitingForMessage implements BehaviourState {

	private long maxBlockTimeInMillis;

	public BehaviourWaitingForMessage() {
		this(-1);
	}
	
	public BehaviourWaitingForMessage(long maxBlockTime) {
		this.maxBlockTimeInMillis = maxBlockTime;
	}

	@Override
	public boolean doBlock(Behaviour behaviour) {
		if (maxBlockTimeInMillis == -1) {
			behaviour.block();		
		}
		else {
			behaviour.block(maxBlockTimeInMillis);		
		}
		return false;
	}
	
	
}
